package LeetCode.LC116;

/**
 * 深度遍历+递归
 * @author corn
 * @create 2020-11-06-10:29
 */
public class Solution {
    public Node connect(Node root) {
        if(root==null){
            return null;
        }
        if(root.left!=null){
            root.left.next=root.right;
            root.right.next=root.next!=null?root.next.left:null;
            connect(root.left);
            connect(root.right);
        }
        return root;
    }
}

